import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'

Vue.use(VueRouter)

const routes = [
    {path: '/demo', component: () => import('@/views/Demo.vue')},
    {path: '/login', component: Login},
    {path: '/404', component: () => import('@/views/error-page/404.vue')},
    // {
    //     path: '',
    //     component: () => import('@/layout/Layout.vue'),
    //     redirect: '/home',
    //     children: [
    //         {
    //             path: '/home',
    //             name: '主页',
    //             component: () => import('@/components/Welcome.vue'),
    //             meta: {title: '主页', icon: 'el-icon-s-home'}
    //         },
    //         // {
    //         //     path: '/user',
    //         //     name: '用户管理',
    //         //     component: User,
    //         //     meta: {title: '用户管理', icon: 'el-icon-user'}
    //         // },
    //         {
    //             path: '/author',
    //             name: '作者管理',
    //             component: () => import('@/views/blog/Author.vue'),
    //             meta: {title: '作者管理', icon: 'el-icon-menu'}
    //         }
    //     ]
    // }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router

const routerComponents = {
    Home: () => import('@/components/Welcome.vue'),
    User: () => import('@/views/user/User.vue'),
    Author: () => import('@/views/blog/Author.vue'),
    Category: () => import('@/views/blog/Category.vue')

}

export { routerComponents }
